/************************************************************************
 * @description 
 * @author 
 * @date 2025/06/18
 * @version 0.0.0
 * 
 * 将每个职业设定一个类
 * 每个职业下面有技能的名称
 * 技能分具有四个属性：
 * 1、坐标x
 * 2、坐标y
 * 3、颜色
 * 4、容差
 ***********************************************************************/
; 读取技能参数

class Skills {
    getSkillData(lv, row) {
        skill := StrSplit(lv.GetText(row, 4), ",")
        if (skill.Length != 0)
            return { x: skill[1], y: skill[2], color: skill[3], t: skill[4] }
        else
            return { x: 0, y: 0, color: "", t: 0 }
    }
}
class warlock extends Skills {
    __New(lv) {
        this.getSkillValue(lv)
        ; 创建绑定函数对象
        this.bindBlackSkill := ObjBindMethod(this, "blackSkill")
        this.bindLongBlackSkill := ObjBindMethod(this, "longBlackSkill")
        this.bindShortBlackSkill := ObjBindMethod(this, "shortBlackSkill")
    }
    ; 获取所有技能值
    getSkillValue(lv) {
        this.zsv := this.getSkillData(lv, 1)
        this.zs4 := this.getSkillData(lv, 2)
        this.zsf := this.getSkillData(lv, 3)
        this.zst1 := this.getSkillData(lv, 4)
        this.zst2 := this.getSkillData(lv, 5)
        this.zs2 := this.getSkillData(lv, 6)
        this.zsr := this.getSkillData(lv, 7)
    }
    PressV() => PixelSearch(&x, &y, this.zsv.x, this.zsv.y, this.zsv.x, this.zsv.y, this.zsv.color, this.zsv.t)
    Press4() => PixelSearch(&x, &y, this.zs4.x, this.zs4.y, this.zs4.x, this.zs4.y, this.zs4.color, this.zs4.t)
    PressF() => PixelSearch(&x, &y, this.zsf.x, this.zsf.y, this.zsf.x, this.zsf.y, this.zsf.color, this.zsf.t)
    PressT1() => PixelSearch(&x, &y, this.zst1.x, this.zst1.y, this.zst1.x, this.zst1.y, this.zst1.color, this.zst1.t)
    PressT2() => PixelSearch(&x, &y, this.zst2.x, this.zst2.y, this.zst2.x, this.zst2.y, this.zst2.color, this.zst2.t)
    PressS2() => PixelSearch(&x, &y, this.zs2.x, this.zs2.y, this.zs2.x, this.zs2.y, this.zs2.color, this.zs2.t)
    PressR() => PixelSearch(&x, &y, this.zsr.x, this.zsr.y, this.zsr.x, this.zsr.y, this.zsr.color, this.zsr.t)
    ; 副技能循环
    rbGetColor() {
        if (this.PressT1() or this.PressT2()) {
            Send("t")
            Sleep(10)
        } else if (this.PressF()) {
            Send("f")
            Sleep(10)
        }
    }
    ; 暗系技能循环
    blackSkill() {
        mana := memoryClass.getMana()
        if (mana < 3 or this.PressR()) {
            Send("r")
            Sleep(10)
            this.rbGetColor()
        }
        if (!this.Press4()) {
            Send("4")
            Sleep(10)
            this.rbGetColor()
        }
        if (this.PressF()) {
            Send("f")
            Sleep(10)
            this.rbGetColor()
        }
        if (!this.PressV()) {
            Send("v")
            Sleep(10)
            this.rbGetColor()
        }
        if (this.PressS2()) {
            Send("2")
            Sleep(10)
            this.rbGetColor()
        } else {
            this.rbGetColor()
        }
    }
    ; 长按技能循环
    longBlackSkill(ThisHotkey) {
        while GetKeyState(ThisHotkey, "p") {
            this.blackSkill()
        }
    }
    ; 短按技能循环
    shortBlackSkill(*) {
        static skillStatue := false
        skillStatue := !skillStatue
        if (skillStatue = true) {
            SetTimer(this.bindBlackSkill, 10)
            skillStatue := true
        }
        if (skillStatue = false) {
            SetTimer(this.bindBlackSkill, 0)
            skillStatue := false
        }
    }
    ; 绑定热键
    hotKeyBind() {
        HotIfWinActive("剑灵")
        Hotkey(getHotkeyValue(main.longPress.Text), this.bindLongBlackSkill, "T10")
        Hotkey(getHotkeyValue(main.shortPress.Text), this.bindShortBlackSkill, "T10")
    }
}
class berserkerk extends Skills {
    __New(lv) {
        this.getSkillValue(lv)
        ; 创建绑定函数对象
        this.bindBlackSkill := ObjBindMethod(this, "blackSkill")
        this.bindLongBlackSkill := ObjBindMethod(this, "longBlackSkill")
        this.bindShortBlackSkill := ObjBindMethod(this, "shortBlackSkill")
    }
    getSkillValue(lv) {

    }
    ; 绑定热键
    hotKeyBind() {
        HotIfWinActive("剑灵")
        Hotkey(getHotkeyValue(main.longPress.Text), this.bindLongBlackSkill, "T10")
        Hotkey(getHotkeyValue(main.shortPress.Text), this.bindShortBlackSkill, "T10")
    }
}
class forceMaster extends Skills {
    __New(lv) {
        this.getSkillValue(lv)
        ; 创建绑定函数对象
        this.bindBlackSkill := ObjBindMethod(this, "blackSkill")
        this.bindLongBlackSkill := ObjBindMethod(this, "longBlackSkill")
        this.bindShortBlackSkill := ObjBindMethod(this, "shortBlackSkill")
    }
    getSkillValue(lv) {


    }
    ; 绑定热键
    hotKeyBind() {
        HotIfWinActive("剑灵")
        Hotkey(getHotkeyValue(main.longPress.Text), this.bindLongBlackSkill, "T10")
        Hotkey(getHotkeyValue(main.shortPress.Text), this.bindShortBlackSkill, "T10")
    }
}
class assassin extends Skills {
    __New(lv) {
        this.getSkillValue(lv)
        ; 创建绑定函数对象
        this.bindBlackSkill := ObjBindMethod(this, "blackSkill")
        this.bindLongBlackSkill := ObjBindMethod(this, "longBlackSkill")
        this.bindShortBlackSkill := ObjBindMethod(this, "shortBlackSkill")
    }
    getSkillValue(lv) {

    }
    ; 绑定热键
    hotKeyBind() {
        HotIfWinActive("剑灵")
        Hotkey(getHotkeyValue(main.longPress.Text), this.bindLongBlackSkill, "T10")
        Hotkey(getHotkeyValue(main.shortPress.Text), this.bindShortBlackSkill, "T10")
    }
}